window.vm = new Vue({
    el: '#app',
    data: {
        all: [],
        all1: [],
        unApp: '',
        user: '',
        count: 6,
        activeName: 'first',
        accepted: null,
        assignProcess: '',
        assignProcess1: '',
        assignProcess2: '',
        assignProcess3: '',
        assignProcess4: '',
        assignProcess5: '',
        process: {
            processNo: '',
            subject: '',
            content: '',
            createName: '',
            userid: '',
            assignName: '',
            respaname: '',
            orgName: '',
            ctime: '',
            etime: '',
            oktime: '',
            state: '',
            remark: '',
            score: '',
            questionPhoto: '',
            isAccepted: '',
            rateRemark: '',
            staffNum: '',
            acceptTime: '',
        },



        // noMore: false, // 控制滚动禁用
        routeLoad: false, // 控制滚动禁用
        limit:18,


        displayOptions:[
            {
                value:"1",
                label:"是"
            },
            {
                value:"0",
                label:"否"
            }
        ],

        members: {
            data: [],
            rules: {
                name: [
                    {required: true, message: "请输入姓名", trigger: ['blur', 'change']},
                    {max: 20, message: "长度在20个字符以内", trigger: ['blur', 'change']},
                ],
                no: [
                    {required: true, message: "请输入工号", trigger: ['blur', 'change']},
                    {max: 20, message: "长度在20个字符以内", trigger: ['blur', 'change']},
                ],
            },
        },
    },

    methods: {
        handleClick(tab, event) {
            // console.log(tab, event);
        },

        toIndex:function(){
            top.location.href="index.html"

        },

        display(value){
            vm.all.respaName = value
        },



        toOneDesk:function (value){
            sessionStorage.setItem("processNo",JSON.stringify(value));
            top.location.href = "oneDesk.html"
        },


        query:function () {
            axios.get(
                "/assign_query1",{
                    params: {
                        userName: vm.user
                    },
                }
            ).then(function (res) {
                vm.all=res.data
            }).catch(e => {
                ajaxError(vm, e);
            });
        },
        //
        // infiniteScroll() {
        //     this.routeLoad = true;
        //     setTimeout(() => {
        //         if (this.all1.length < this.all.length) {
        //             const data = this.all1.concat(
        //                 this.all.slice(this.all1.length, this.all1.length + this.count)
        //             )
        //
        //             this.$set(this, 'all1', data)
        //             this.routeLoad = false
        //         }
        //     }, 100)
        // },



    },


    created: function () {


        //获取所有工单信息
        axios.get(
            "/assign_query",
        ).then(function (res) {
            vm.all=res.data
        }).catch(e => {
            ajaxError(vm, e);
        });



        //获取所有未审批工单信息
        axios.get(
            "/assignProcess1",
        ).then(function (res) {
            vm.unApp=res.data
        }).catch(e => {
            ajaxError(vm, e);
        });

        //获取未指派工单信息
        axios.get(
            "/assignProcess2",
        ).then(function (res) {
            vm.assignProcess=res.data
        }).catch(e => {
            ajaxError(vm, e);
        });




        //已经转派的单（待接收）
        axios.get(
            "/assignProcess",{
                params: {
                    state: 1,
                    is: 0
                },
            }
        ).then(function (res) {
            vm.assignProcess1=res.data
        }).catch(e => {
            ajaxError(vm, e);
        });

        //已经接受（待完成的工单）
        axios.get(
            "/assignProcess",{
                params: {
                    state: 1,
                    is: 1
                },
            }
        ).then(function (res) {
            vm.assignProcess2=res.data
        }).catch(e => {
            ajaxError(vm, e);
        });

        //已经完成
        axios.get(
            "/assignProcess",{
                params: {
                    state: 2,
                    is: 1
                },
            }
        ).then(function (res) {
            vm.assignProcess3=res.data

        }).catch(e => {
            ajaxError(vm, e);
        });

        //已经完成未评价
        axios.get(
            "/assignRateNo",{
                params: {
                    state: 2,
                    is: 1
                },
            }
        ).then(function (res) {
            vm.assignProcess4=res.data
        }).catch(e => {
            ajaxError(vm, e);
        });

        //已经完成已评价
        axios.get(
            "/assignRate",{
                params: {
                    state: 2,
                    is: 1
                },
            }
        ).then(function (res) {
            vm.assignProcess5=res.data
        }).catch(e => {
            ajaxError(vm, e);
        });

    },
});